package com.ruoyi.system.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.IUserProfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 用户画像分析控制器
 */
@RestController
@RequestMapping("/system/userProfile")
public class UserProfileController extends BaseController {

    @Autowired
    private IUserProfileService userProfileService;

    /**
     * 获取用户标签偏好数据 - 无需认证
     */
    @GetMapping("/tagPreferences")
    public AjaxResult getTagPreferences() {
        List<Map<String, Object>> data = userProfileService.getTagPreferences();
        return AjaxResult.success(data);
    }

    /**
     * 获取用户演员偏好数据 - 无需认证
     */
    @GetMapping("/actorPreferences")
    public AjaxResult getActorPreferences() {
        List<Map<String, Object>> data = userProfileService.getActorPreferences();
        return AjaxResult.success(data);
    }

    /**
     * 获取RFM用户分层数据 - 无需认证
     */
    @GetMapping("/rfmAnalysis")
    public AjaxResult getRFMAnalysis() {
        List<Map<String, Object>> data = userProfileService.getRFMAnalysis();
        return AjaxResult.success(data);
    }


    /**
     * 获取统计卡片数据 - 无需认证
     */
    @GetMapping("/stats")
    public AjaxResult getStats() {
        Map<String, Object> data = userProfileService.getStats();
        return AjaxResult.success(data);
    }
}